package com.kingdee.pda.util;

/**
 * 防止重复点击过快
 */

public class FastClickUtil {
    // 两次点击按钮之间的点击间隔不能少于1000毫秒
    private static final int MIN_CLICK_DELAY_TIME = 500;
    private static long lastClickTime;

    /**
     * 防止过快点击
     *
     * @return
     */
    public static boolean isFastClick() {
        return isFastClickByTime(MIN_CLICK_DELAY_TIME);
    }

    public static boolean isFastClickByTime(long delayTime) {
        boolean flag = false;
        long curClickTime = System.currentTimeMillis();
        if ((curClickTime - lastClickTime) >= delayTime) {
            flag = true;
        }
        lastClickTime = curClickTime;
        return !flag;
    }
}
